In computer systems, garbage collection refers to automated memory reclamation. Specifically, a garbage collector is a process that differentiates between live objects (i.e., objects that are still in use) and dead objects (i.e., objects that are no longer in use). Differentiating between live objects and dead objects typically involves traversing a graph of live objects to identify objects that should not be discarded.
Once live objects are identified, the garbage collector frees memory occupied by dead objects, and the freed memory is then available for other uses. In contrast, manual memory reclamation requires software developers to write code to explicitly free memory when objects are no longer needed. Errors in manual memory reclamation code may result in unnecessarily large memory footprints, memory leaks, etc. Thus, garbage collection reduces the probability of such errors occurring.